package com.icinfo.cloud.provider.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.ObjectUtils;

/**
 * 访问页面枚举 1案源详情 2案件详情 3审批页面 4文书查询
 * @author liyafeng
 * @date 2022/11/12
 */
@AllArgsConstructor
public enum ViewPageEnum {

    /**
     * 访问页面枚举
     */
    VIEW_PAGE_CASESOURCE_DETAIL("1", "案源详情"),
    VIEW_PAGE_CASE_DETAIL("2", "案件详情"),
    VIEW_PAGE_APPROVAL("3", "审批页面"),
    VIEW_PAGE_DOC_SELECT("4", "文书查询");

    /**
     * 编码
     */
    @Getter
    private String viewPageCode;
    /**
     * 描述
     */
    @Getter
    private String viewPageDesc;

    /**
     * 根据code获取Desc
     * @author liyafeng
     * @date 2023/2/24
      * @param viewPageCode
     * @return {@link String}
     */
    public static String getValueByCode(String viewPageCode) {
        if (ObjectUtils.isEmpty(viewPageCode)) {
            return null;
        }
        for (ViewPageEnum e : ViewPageEnum.values()) {
            if (viewPageCode.equals(e.getViewPageCode())) {
                return e.getViewPageDesc();
            }
        }
        return null;
    }

}
